//
//  HMCaseManageCell.m
//  仿真开发
//
//  Created by B.HOPE on 2017/3/24.
//  Copyright © 2017年 B.HOPE. All rights reserved.
//

#import "HMCaseManageCell.h"
#import <Masonry.h>

@interface HMCaseManageCell ()

/**
 时间
 */
@property (nonatomic, strong) UILabel *timeLabel;

/**
 选取图片
 */
@property (nonatomic, strong) UIImageView *imgView;

/**
 病症
 */
@property (nonatomic, strong) UILabel *symptomLabel;

@end

@implementation HMCaseManageCell

- (void)awakeFromNib {
    [super awakeFromNib];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self setupUI];
    }
    return self;
}

- (void)setupUI
{
    UIImageView *icon = [[UIImageView alloc] init];
    icon.image = [UIImage imageNamed:@"illness_rb_img_sel.png"];
    [icon sizeToFit];
    [self.contentView addSubview:icon];
    [icon mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.offset(10);
    }];
    
    _timeLabel = [[UILabel alloc] init];
    _timeLabel.text = @"2056-05-18 19:56:53";
    _timeLabel.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:_timeLabel];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(icon);
        make.left.equalTo(icon.mas_right).offset(10);
    }];
    
    UIView *leftView = [[UIView alloc] init];
    leftView.backgroundColor = [UIColor cyanColor];
    [self.contentView addSubview:leftView];
    [leftView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(icon);
        make.top.equalTo(icon.mas_bottom).offset(10);
        make.bottom.offset(-10);
        make.width.offset(10);
        make.height.offset(120);
    }];
    
    _imgView = [[UIImageView alloc] init];
    _imgView.image = [UIImage imageNamed:@"doctor_defaultphoto_male"];
    [self.contentView addSubview:_imgView];
    [_imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.bottom.equalTo(leftView);
        make.left.equalTo(_timeLabel);
        make.width.equalTo(_imgView.mas_height);
    }];
    
    _symptomLabel = [[UILabel alloc] init];
    _symptomLabel.text = @"不完全生长候群症";
    _symptomLabel.font = [UIFont systemFontOfSize:16];
    [self.contentView addSubview:_symptomLabel];
    [_symptomLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(_imgView);
        make.left.equalTo(_imgView.mas_right).offset(10);
    }];
}

- (void)setModel:(HMCaseManageAllModel *)model
{
    _model = model;
    
    
    _symptomLabel.text = model.virustype;
    _timeLabel.text = model.time;
    
    if (model.arrayImg.count == 0)
    {
        return;
    }
    _imgView.image = model.arrayImg[0];
}


@end
